package day6.ObLong;

public class ObLong {
	/*
	 * 3、定义长方形类，含：
			属性：宽、高（整型）；
			方法：求周长、面积；
			构造方法3个：（1）无参——宽、高默认值为1；（2）1个参数——宽、高相等；（3）2个参数——宽、高各为参数值。
			要求：进行测试计算周长和面积。
	 */
	private int width;
	private int high;
	
	//无参——宽、高默认值为1
	public ObLong() {
		this.width = 1;
		this.high = 1;
	}
	
	//1个参数——宽、高相等
	public ObLong(int width) {
		this.width = width;
		this.high = this.width;
	}

	//2个参数——宽、高各为参数值
	public ObLong(int width, int high) {
		this.width = width;
		this.high = high;
	}
	
	public int circumferen(int high,int width) {
		System.out.println("长方形的周长为" + (high + width) * 2);
		return (high + width) * 2;
	}
	
	public int area(int high,int width) {
		System.out.println("长方形的面积为" + (high * width) );
		return high * width;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHigh() {
		return high;
	}

	public void setHigh(int high) {
		this.high = high;
	}
	
	
	
	
}
